import { createRouter, createWebHistory } from 'vue-router'; // Vue 3 的导入方式

const routes = [
    { 
        path: '/', 
        component: ()=>import('../views/AppHome.vue')
    },
    { 
        path: '/personal', 
        component: ()=>import('../views/AppPersonalCenter.vue')
    },
    { 
        path: '/community', 
        component: ()=>import('../views/AppCommunity.vue')
    },
    { 
        path: '/recommend/popularDestinations', 
        component: ()=>import('../views/AppRecommend.vue'),
        children:[
            {
                path:'',
                component:()=>import('../views/RecommendComponents/PopularDestinations.vue')
            },
            {
                path:'/recommend/featuredTours',
                component:()=>import('../views/RecommendComponents/FeaturedTours.vue')
            },
            {
                path:'/recommend/travelerReviews',
                component:()=>import('../views/RecommendComponents/TravelerReviews.vue')
            },
            {
                path:'/recommend/newsletterSubscription',
                component:()=>import('../views/RecommendComponents/NewsletterSubscription.vue')
            }
        ],
    },
    { 
        path: '/guide', 
        component: ()=>import('../views/AppStrategyGuide.vue')
    },
    { 
        path: '/login', 
        component: ()=>import('../views/AppLogin.vue')
    },
    { 
        path: '/register',
        component: ()=>import('../views/AppRegister.vue')
    },
    {
        name:'DestinationDetail',
        path: '/detail/:id',
        component:()=>import('../views/DestinationDetail.vue'),
        props: true
    },
    { 
        path: '/:pathMatch(.*)*',
        component: ()=>import('../views/NotFound.vue'), 
        meta: {
            hideHeader: true
        } 
    },
    ]

const router = createRouter({
    history: createWebHistory(), // 或者 createWebHashHistory()
    routes
});

export default router; // 导出路由实例
